﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DIPLib
{
    public class MyBitmap
    {
        byte[] mData;
        int mWidth;
        int mHeight;

        public int Width
        {
            set
            {
                mWidth = value;
            }
            get
            {
                return mWidth;
            }

        }
        public int Height
        {
            set
            {
                mHeight = value;
            }
            get
            {
                return mHeight;
            }
        }

        public MyBitmap(byte[] data, int width, int height)
        {
            mData = data;
            mWidth = width;
            mHeight = height;
        }

        public byte getPixel(int x, int y) // column, row, so x max is Width, y max is Height
        {
            return mData[(y * Width + x) * 4];
        }

        public void setPixel(int x, int y, byte value)
        {
            mData[(y * Width + x) * 4] = mData[(y * Width + x) * 4 + 1] = mData[(y * Width + x) * 4 + 2] = value;
            mData[(y * Width + x) * 4 + 3] = 255;
        }

    }
}
